package io;


import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * 缓冲输出流写出时的缓冲区问题
 */
public class BOSDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("javaSE/bos.txt");
        BufferedOutputStream bos = new BufferedOutputStream(fos);

        String line = "super idol 的笑容都没你的甜~";
        byte[] data = line.getBytes(StandardCharsets.UTF_8);

        bos.write(data);
        /*
            flush操作输出缓冲区全部内容
         */
        bos.flush();
        System.out.println("写出完毕!");


        bos.close();



    }
}
